<!-- 概览栏 -->
<template>
  <div class="overview">
    <div class="left">
      <Icon type="gaishu"></Icon>

      <div
        v-for="(item, index) in readBreadcrumbs"
        :key="item.id"
        class="item"
        :class="{
          first: index === 0,
          active: item.isSelected,
        }"
      >
        <span class="line" v-if="index !== 0">/</span>
        <span class="text">{{ item.title }}</span>
      </div>

    </div>
    <div class="rigth">
      <el-avatar :size="40" :src="readUserInfo.avatar" class="avatar" />
      <div class="more">
        <span class="moreText">更多</span>
        <Icon type="more"></Icon>
        <ul class="moreOption">
          <li v-for="item in headRouterData" :key="item.id" @click="headleSelect(item)">{{ item.title }}</li>
          <li @click="Logout">退出</li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script setup>
import Icon from "@/components/Icon/index.vue";
import { storeToRefs } from "pinia";
import { useUserStore } from "@/store/useUserStore.js";
import { useMenuStore } from "@/store/useMenuStore.js";
import { ref } from "vue";
const { readUserInfo } = storeToRefs(useUserStore());
const {Logout} = useUserStore();
const { readBreadcrumbs,readRenderingMenu } = storeToRefs(useMenuStore());
const { getReactiveSelect } = useMenuStore();
const headRouterData = ref([])
headRouterData.value = readRenderingMenu.value.filter(item => item.belong === "head")
const headleSelect = (item) => {
  getReactiveSelect(item)
}
</script>

<style lang="less" scoped>
@import "@/styles/var.less";
@overviewHigth: 60px;
@ulHigth: 160px;
.overview {
  display: flex;
  justify-content: space-between;
  line-height: @overviewHigth;
  width: 100%;
  background-color: @white;
  height: @overviewHigth;
  padding: 0 30px;
  .left {
    display: flex;
    .first {
      margin-left: 30px;
    }
    .item {
      span {
        margin-right: 10px;
      }
    }
    .active {
      color: @gray;
    }
  }

  .rigth {
    display: flex;
    position: relative;
    align-items: center;
    .avatar {
      line-height: @overviewHigth;
    }
    .more {
      width: 90px;
      text-align: center;
      cursor: pointer;
      margin-left: 30px;
      color: @dark;
      &:hover {
        .moreText {
          color: @primary;
        }
        .icon-container {
          transform: rotate(90deg);
          color: @primary;
        }
      }
      &:hover .moreOption {
        height: @ulHigth;
      }
      .icon-container {
        transform: rotate(-90deg);
        display: inline-block;
        font-size: 0.1em;
        margin-left: 10px;
      }
      .moreOption {
        z-index: 99999;
        transition: all 0.2s;
        height: 0;
        overflow: hidden;
        position: absolute;
        right: 0;
        top: 60px;
        background: @white;
        width: 90px;
        text-align: center;
        
        li {
          cursor: pointer;
          height: 40px;
          line-height: 40px;
          &:hover {
            background: @primary;
            color: @white;
          }
        }
      }
    }
  }
}
</style>